<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1></h1>
    <script>
        let h=document.querySelector("h1");
        function fun(){
            let num=5;
            setInterval(() => {
                h.innerHTML=`${num}`
                num--
                num==0 ? location.href="http://baidu.com":undefined
            }, 1000);
        }
        fun()
    </script>
</body>
</html>